package com.geline.sqlbackup.thirdjar;

import java.sql.SQLType;

/**
 * 参考：com.microsoft.sqlserver-sqljdbc4.jar  JDBCType.java
 * @author mengx
 * @version 2020/12/27 22:43
 */
public enum SqlServerType implements SQLType {
    INT("INT", 4),  //add by mengx 20201227
    DATETIME2("DATETIME2", 93),  //add by mengx 20201227
    UNKNOWN("UNKNOWN", 999),
    ARRAY("ARRAY", 2003),
    BIGINT("BIGINT", -5),
    BINARY("BINARY", -2),
    BIT("BIT", -7),
    BLOB("BLOB", 2004),
    BOOLEAN("BOOLEAN", 16),
    CHAR("CHAR", 1),
    CLOB("CLOB", 2005),
    DATALINK("DATALINK", 70),
    DATE("DATE", 91),
    DATETIMEOFFSET("DATETIMEOFFSET", -155),
    DECIMAL("DECIMAL", 3),
    DISTINCT("DISTINCT", 2001),
    DOUBLE("DOUBLE", 8),
    FLOAT("FLOAT", 6),
    INTEGER("INTEGER", 4),
    JAVA_OBJECT("JAVA_OBJECT", 2000),
    LONGNVARCHAR("LONG_NCHARACTER", -16),
    LONGVARBINARY("LONG_BINARY", -4),
    LONGVARCHAR("LONG_CHARACTER", -1),
    NCHAR("NCHARACTER", -15),
    NCLOB("NCLOB", 2011),
    NULL("NULL", 0),
    NUMERIC("NUMERIC", 2),
    NVARCHAR("NCHARACTER", -9),
    OTHER("UNKNOWN", 1111),
    REAL("NUMERIC", 7),
    REF("UNKNOWN", 2006),
    ROWID("UNKNOWN", -8),
    SMALLINT("NUMERIC", 5),
    SQLXML("SQLXML", 2009),
    STRUCT("UNKNOWN", 2002),
    TIME("TIME", 92),
    TIMESTAMP("TIMESTAMP", 93),
    TINYINT("NUMERIC", -6),
    VARBINARY("BINARY", -3),
    VARCHAR("VARCHAR", 12);

    private final String typeName;
    private final int code;

    SqlServerType(String typeName, int code) {
        this.typeName = typeName;
        this.code = code;
    }

    @Override
    public String getName() {
        return typeName;
    }

    @Override
    public String getVendor() {
        return "SqlServer Database";
    }

    @Override
    public Integer getVendorTypeNumber() {
        return this.code;
    }
}
